package com.ruoyi.net.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.net.domain.ElementBusiMtnChannelProtect;
import com.ruoyi.net.domain.ElementBusiMtnChannelProtectListVo;
import com.ruoyi.net.mapper.ElementBusiMtnChannelProtectMapper;
import com.ruoyi.net.service.IElementBusiMtnChannelProtectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 网元-业务-MTN Channel-保护属性Service业务层处理
 * 
 * @author tony
 * @date 2024-12-08
 */
@Service
public class ElementBusiMtnChannelProtectServiceImpl implements IElementBusiMtnChannelProtectService 
{
    @Autowired
    private ElementBusiMtnChannelProtectMapper elementBusiMtnChannelProtectMapper;

    /**
     * 查询网元-业务-MTN Channel-保护属性
     * 
     * @param id 网元-业务-MTN Channel-保护属性主键
     * @return 网元-业务-MTN Channel-保护属性
     */
    @Override
    public ElementBusiMtnChannelProtect selectElementBusiMtnChannelProtectById(String id)
    {
        return elementBusiMtnChannelProtectMapper.selectElementBusiMtnChannelProtectById(id);
    }

    /**
     * 查询网元-业务-MTN Channel-保护属性列表
     * 
     * @param elementBusiMtnChannelProtect 网元-业务-MTN Channel-保护属性
     * @return 网元-业务-MTN Channel-保护属性
     */
    @Override
    public List<ElementBusiMtnChannelProtectListVo> selectElementBusiMtnChannelProtectList(ElementBusiMtnChannelProtect elementBusiMtnChannelProtect)
    {
        return elementBusiMtnChannelProtectMapper.selectElementBusiMtnChannelProtectList(elementBusiMtnChannelProtect);
    }

    /**
     * 新增网元-业务-MTN Channel-保护属性
     * 
     * @param elementBusiMtnChannelProtect 网元-业务-MTN Channel-保护属性
     * @return 结果
     */
    @Override
    public int insertElementBusiMtnChannelProtect(ElementBusiMtnChannelProtect elementBusiMtnChannelProtect)
    {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(elementBusiMtnChannelProtect.getId())) {
            elementBusiMtnChannelProtect.setId(uuid);
        }
        elementBusiMtnChannelProtect.setCreateBy(SecurityUtils.getUsername());
        elementBusiMtnChannelProtect.setCreateTime(DateUtils.getNowDate());
        elementBusiMtnChannelProtect.setUpdateBy(SecurityUtils.getUsername());
        elementBusiMtnChannelProtect.setUpdateTime(DateUtils.getNowDate());
        return elementBusiMtnChannelProtectMapper.insertElementBusiMtnChannelProtect(elementBusiMtnChannelProtect);
    }

    /**
     * 修改网元-业务-MTN Channel-保护属性
     * 
     * @param elementBusiMtnChannelProtect 网元-业务-MTN Channel-保护属性
     * @return 结果
     */
    @Override
    public int updateElementBusiMtnChannelProtect(ElementBusiMtnChannelProtect elementBusiMtnChannelProtect)
    {
        elementBusiMtnChannelProtect.setUpdateBy(SecurityUtils.getUsername());
        elementBusiMtnChannelProtect.setUpdateTime(DateUtils.getNowDate());
        return elementBusiMtnChannelProtectMapper.updateElementBusiMtnChannelProtect(elementBusiMtnChannelProtect);
    }

    /**
     * 批量删除网元-业务-MTN Channel-保护属性
     * 
     * @param ids 需要删除的网元-业务-MTN Channel-保护属性主键
     * @return 结果
     */
    @Override
    public int deleteElementBusiMtnChannelProtectByIds(String[] ids)
    {
        return elementBusiMtnChannelProtectMapper.deleteElementBusiMtnChannelProtectByIds(ids);
    }

    /**
     * 删除网元-业务-MTN Channel-保护属性信息
     * 
     * @param id 网元-业务-MTN Channel-保护属性主键
     * @return 结果
     */
    @Override
    public int deleteElementBusiMtnChannelProtectById(String id)
    {
        return elementBusiMtnChannelProtectMapper.deleteElementBusiMtnChannelProtectById(id);
    }
}
